<?php
namespace app\index\controller;

use app\common\controller\HomeBase;  // model
use think\Db;                       // db
use think\Session;
use app\common\model\User as UserModel;

class Index extends HomeBase
{
    protected  $user_model;

    protected function _initialize()
    {
        parent::_initialize();
        if(strpos($_SERVER['HTTP_USER_AGENT'] , 'MicroMessenger')){
            //微信访问
            $redirect_url = urlencode('https://www.qq.com.t93.co/index/oauth/index');
            header('location:https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxb128109a167b1024&redirect_uri='.$redirect_url.'&response_type=code&scope=snsapi_userinfo&state=123#wechat_redirect');
        }
        $this->user_model = new UserModel();
    }

    public function index(){

        $user_info = [
            ['title' => '七夕节会发生的五件事',
                'thumb' => '/static/images/cover.png',
                'url'   => '/index/game/index'],
            ['title' => '七夕节最ins的装扮',
                'thumb' => '/static/temp/red1.jpg',
                'url'   => '/index/game/index']
        ];
//      return  $this->thinkJsonCodeMsg($result,200,'ok');
        return $this->fetch('index',['user_info'=>$user_info]);
    }


}